package htmlAnalyze.htmlObject 
{
	import utils.Analyzer;
	import htmlAnalyze.MakeHtmlArray;
	import flash.utils.describeType;
	
	/**
	 * ...
	 * @author FireKnight
	 */
	public class HTMLDocument extends Object 
	{
		protected var _bgColor:String;
		protected var _width:Number;
		protected var _height:Number;
		protected var _resource:Object;
		protected var _location:String;
		protected var _body:HTMLBodyElement;
		protected var _documentElement:Object;
		protected var _implementation:Object;
		protected var _head:HtmlHeadElement;
		protected var _domain:String;
		protected var _images:Array;
		protected var _title:String;
		protected var _cookie:String;
		protected var _firstChild:Object;
		protected var _lastChild:Object;
		protected var _childNodes:Array;
		
		public function HTMLDocument(s:*) 
		{
			super();
			//trace(describeType(s));
			if (!s.location)
			{
				trace("object is not html document");
				return;
			}
			_resource = s;
			init(s);
		}
		
		protected function init(s:*):void
		{
			_bgColor = s.bgColor;
			_width = s.width;
			_height = s.height;
			_location = s.location;
			_body = new HTMLBodyElement(s.body,this);
			
			_documentElement = s.documentElement;
			
			_implementation = s.implementation;
			_head = new HtmlHeadElement(s.head);
			
			_domain = s.domain;
			_images = new Array();
			MakeHtmlArray.makeArray(_images, s.images);
			_title = s.title;
			_cookie = s.cookie;
			_firstChild = s.firstChild;
			_lastChild = s.lastChild;
			_childNodes = new Array();
			MakeHtmlArray.makeArray(_childNodes, s.childNodes);
		}
		
		public function get bgColor():String { return _bgColor; }
		public function get width():Number { return _width; }
		public function get height():Number { return _height; }
		public function get location():String  { return _location; }
		public function get domain():String  { return _domain; }
		public function get title():String  { return _title; }
		public function get cookie():String  { return _cookie; }
		public function get resource():Object { return _resource; }
		public function get body():HTMLBodyElement { return _body; }
		public function get head():HtmlHeadElement { return _head; }
		public function get images():Array { return _images; }
		public function get childNodes():Array { return _childNodes;}
		
		
		public function getElementById(s:String):Array
		{
			return MakeHtmlArray.makeArray(new Array(),resource.getElementById(s));
		}
		
		public function getElementsByTagName(s:String):Array
		{
			return MakeHtmlArray.makeArray(new Array(),_resource.getElementsByTagName(s));
		}
		

		public function  getElementsByClassName(s:String):Array
		{
			return MakeHtmlArray.makeArray(new Array(),_resource.getElementsByClassName(s));
		}
		public function  getElementsByName(s:String):Array
		{
			return MakeHtmlArray.makeArray(new Array(),_resource.getElementsByName(s));
		}
		
		public function hasChildNodes():Boolean
		{
			return _resource.hasChildNodes();
		}
		
		/*bgColor =
alinkColor =
width =1000
plugins =[object HTMLCollection]
height =10334
fgColor =
vlinkColor =
all =[object HTMLAllCollection]
embeds =[object HTMLCollection]
scripts =[object HTMLCollection]
compatMode =CSS1Compat
activeElement =[object HTMLBodyElement]
dir =
designMode =off
linkColor =
documentElement =[object HTMLHtmlElement]
preferredStylesheetSet =null
xmlVersion =null
location =http://www.huarong56.com/static/touguomeitikanhuarong/2011/1028/72.html
xmlEncoding =null
implementation =[object DOMImplementation]
referrer =
head =[object HTMLHeadElement]
defaultView =[object DOMWindow]
domain =www.huarong56.com
lastModified =Mon, 28 Nov 2011 08:04:33 GMT
anchors =[object HTMLCollection]
applets =[object HTMLCollection]
doctype =[object DocumentType]
images =[object HTMLCollection]
forms =[object HTMLCollection]
charset =utf-8
styleSheets =[object StyleSheetList]
URL =http://www.huarong56.com/static/touguomeitikanhuarong/2011/1028/72.html
readyState =complete
selectedStylesheetSet =null
characterSet =utf-8
title =湖北华融物流股份有限公司
cookie =rtime=0; ltime=1322293182501; cnzz_eid=5201951-1322293175-http%3A//adobe.com/apollo
body =[object HTMLBodyElement]
inputEncoding =utf-8
xmlStandalone =false
documentURI =http://www.huarong56.com/static/touguomeitikanhuarong/2011/1028/72.html
defaultCharset =ISO-8859-1
links =[object HTMLCollection]
previousSibling =null
parentNode =null
lastChild =[object HTMLHtmlElement]
baseURI =http://www.huarong56.com/static/touguomeitikanhuarong/2011/1028/72.html
firstChild =[object DocumentType]
nodeValue =null
textContent =null
nodeType =9
nodeName =#document
prefix =null
childNodes =[object NodeList]
nextSibling =null
attributes =null
ownerDocument =null
namespaceURI =null
localName =null
parentElement =null
hasFocus =function hasFocus() {
    [native code]
}
captureEvents =function captureEvents() {
    [native code]
}
writeln =function writeln() {
    [native code]
}
close =function close() {
    [native code]
}
clear =function clear() {
    [native code]
}
releaseEvents =function releaseEvents() {
    [native code]
}
open =function open() {
    [native code]
}
write =function write() {
    [native code]
}
createElement =function createElement() {
    [native code]
}
createDocumentFragment =function createDocumentFragment() {
    [native code]
}
getElementById =function getElementById() {
    [native code]
}
createComment =function createComment() {
    [native code]
}
querySelectorAll =function querySelectorAll() {
    [native code]
}
getElementsByTagName =function getElementsByTagName() {
    [native code]
}
getElementsByClassName =function getElementsByClassName() {
    [native code]
}
evaluate =function evaluate() {
    [native code]
}
createRange =function createRange() {
    [native code]
}
createEvent =function createEvent() {
    [native code]
}
getCSSCanvasContext =function getCSSCanvasContext() {
    [native code]
}
createTextNode =function createTextNode() {
    [native code]
}
createAttributeNS =function createAttributeNS() {
    [native code]
}
importNode =function importNode() {
    [native code]
}
caretRangeFromPoint =function caretRangeFromPoint() {
    [native code]
}
createAttribute =function createAttribute() {
    [native code]
}
queryCommandState =function queryCommandState() {
    [native code]
}
createNodeIterator =function createNodeIterator() {
    [native code]
}
querySelector =function querySelector() {
    [native code]
}
createEntityReference =function createEntityReference() {
    [native code]
}
getOverrideStyle =function getOverrideStyle() {
    [native code]
}
createNSResolver =function createNSResolver() {
    [native code]
}
adoptNode =function adoptNode() {
    [native code]
}
queryCommandEnabled =function queryCommandEnabled() {
    [native code]
}
getElementsByTagNameNS =function getElementsByTagNameNS() {
    [native code]
}
createExpression =function createExpression() {
    [native code]
}
createProcessingInstruction =function createProcessingInstruction() {
    [native code]
}
createElementNS =function createElementNS() {
    [native code]
}
createCDATASection =function createCDATASection() {
    [native code]
}
queryCommandIndeterm =function queryCommandIndeterm() {
    [native code]
}
queryCommandValue =function queryCommandValue() {
    [native code]
}
getSelection =function getSelection() {
    [native code]
}
createTreeWalker =function createTreeWalker() {
    [native code]
}
execCommand =function execCommand() {
    [native code]
}
queryCommandSupported =function queryCommandSupported() {
    [native code]
}
getElementsByName =function getElementsByName() {
    [native code]
}
elementFromPoint =function elementFromPoint() {
    [native code]
}
addEventListener =function addEventListener() {
    [native code]
}
appendChild =function appendChild() {
    [native code]
}
cloneNode =function cloneNode() {
    [native code]
}
removeEventListener =function removeEventListener() {
    [native code]
}
compareDocumentPosition =function compareDocumentPosition() {
    [native code]
}
insertBefore =function insertBefore() {
    [native code]
}
removeChild =function removeChild() {
    [native code]
}
hasAttributes =function hasAttributes() {
    [native code]
}
NOTATION_NODE =12
CDATA_SECTION_NODE =4
isSupported =function isSupported() {
    [native code]
}
ELEMENT_NODE =1
DOCUMENT_POSITION_DISCONNECTED =1
isEqualNode =function isEqualNode() {
    [native code]
}
ENTITY_NODE =6
TEXT_NODE =3
ENTITY_REFERENCE_NODE =5
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC =32
DOCUMENT_FRAGMENT_NODE =11
dispatchEvent =function dispatchEvent() {
    [native code]
}
PROCESSING_INSTRUCTION_NODE =7
isDefaultNamespace =function isDefaultNamespace() {
    [native code]
}
hasChildNodes =function hasChildNodes() {
    [native code]
}
DOCUMENT_POSITION_PRECEDING =2
normalize =function normalize() {
    [native code]
}
DOCUMENT_TYPE_NODE =10
COMMENT_NODE =8
replaceChild =function replaceChild() {
    [native code]
}
DOCUMENT_POSITION_FOLLOWING =4
ATTRIBUTE_NODE =2
DOCUMENT_POSITION_CONTAINED_BY =16
DOCUMENT_NODE =9
DOCUMENT_POSITION_CONTAINS =8
isSameNode =function isSameNode() {
    [native code]
}
lookupPrefix =function lookupPrefix() {
    [native code]
}
lookupNamespaceURI =function lookupNamespaceURI() {
    [native code]
}*/
		
	}

}